﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Manager_System
{
    public partial class add_material : Form
    {
        public add_material()
        {
            InitializeComponent();
        }

        private void add_material_Load(object sender, EventArgs e)
        {
            note_tb.MaxLength = 50;

        }

        private void note_tb_TextChanged(object sender, EventArgs e)
        {
            view_lb.Text = (50 - note_tb.Text.Length).ToString()+"个汉字";

        }

        private void button1_Click(object sender, EventArgs e)
        {

            string sql = "insert into T_material (NAME,note)values('"+name_tb.Text.Trim()+"','"+note_tb.Text.Trim()+"')";
            DBhelp db = new DBhelp();
            int rs = db.update(sql);
            if (rs == 1)
            {
                MessageBox.Show("添加成功！");
             
            }
            else 
            {
                MessageBox.Show("添加失败！");

            }
            db.close();
            
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
